/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package top.wuhaojie.scrollnumber.slice;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import top.wuhaojie.library.MultiScrollNumber;
import top.wuhaojie.scrollnumber.ResourceTable;

/**
 * lipeiquan
 *
 * @since 2021-04-22
 */
public class MainAbilitySlice extends AbilitySlice {
    private final double mNumber = 20.48;
    private final int mScrollVelocity = 100;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        MultiScrollNumber scrollNumber = (MultiScrollNumber) findComponentById(ResourceTable.Id_scroll_number);
        int[] ints = {top.wuhaojie.library.ResourceTable.Color_red01, top.wuhaojie.library.ResourceTable.Color_orange01,
            top.wuhaojie.library.ResourceTable.Color_blue01, top.wuhaojie.library.ResourceTable.Color_green01,
            top.wuhaojie.library.ResourceTable.Color_purple01};
        scrollNumber.setTextColors(ints);
        scrollNumber.setScrollVelocity(mScrollVelocity);
        scrollNumber.setTextFont("myfont.ttf");
        scrollNumber.setNumber(mNumber);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
